<h1><span></span><?= lang('label_checkout') ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><a href="<?= base_url('user/profile') ?>"><?= lang('label_profile') ?></a></li>
    <li><a href="<?= base_url('cart') ?>"><?= lang('label_shoping_cart') ?></a></li>
    <li><?= lang('label_checkout') ?></li>
</ul>


<div class="page">
    <div class="invoice">
        <b>&raquo; <?= lang('label_created_date') ?> :</b>  <?= date("Y/m/d H:i:s"); ?>
    </div>
    <table id="tablestyle3">
        <thead>
            <tr>
                <th style="width:38%;"><?= lang('label_items') ?></th>
                <th style="width:11%;"><?= lang('label_product_price') ?></th>
                <th style="width:10%;"><?= lang('label_product_quentity') ?></th>
                <th style="width:11%;"><?= lang('label_shiping') ?></th>
                <th style="width:10%;"><?= lang('label_discount') ?></th>
                <th style="width:20;"><?= lang('label_total') ?></th>
            </tr>
        </thead>

        <tbody>
            <?php
            $price = 0;
            $shiping = 0;
            $discount = 0;
            foreach($items as $item){ ?>
            <tr>
                <td><?= $item->title ?></td>
                <td><?= $item->price ?></td>
                <td><?= $item->amount ?></td>
                <td><?= $item->shiping ?></td>
                <td><?= $item->discount ?></td>
                <td><b><?= $item->total_price ?></b> <?= lang('label_rial') ?></td>
            </tr>
            <?php 
            $price += $item->price * $item->amount;
            $shiping += $item->shiping;
            $discount += $item->discount;
            } ?>
            <tr>
                <td colspan="5"><?= lang('label_sub_total') ?></td>
                <td><b><?= $price ?></b> <?= lang('label_rial') ?></td>
            </tr>
            <tr>
                <td colspan="5"><?= lang('label_shiping_total') ?></td>
                <td><b><?= $shiping ?></b> <?= lang('label_rial') ?></td>
            </tr>
            <tr>
                <td colspan="5"><?= lang('label_discount_total') ?></td>
                <td><b><?= $discount ?></b> <?= lang('label_rial') ?></td>
            </tr>
            <tr style="border-top:4px solid #e7e7e7;">
                <td colspan="5"><strong><?= lang('label_item_total') ?></strong></td>
                <td><span><?= $price + $shiping - $discount ?></span> <?= lang('label_rial') ?></td>
            </tr>
        </tbody>
    </table>
    
    <form action="<?= current_url() ?>" class="forms inside_1" method="post">
    <div class="submit">
                <input name="submit" value="<?= lang('accept_payment') ?>" type="submit"  >
            </div>
    </form>

</div>
